package ltd.newbee.mall.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import ltd.newbee.mall.entity.NewBeeMallOrderItem;
import ltd.newbee.mall.mapper.NewBeeMallOrderItemMapper;
import ltd.newbee.mall.service.NewBeeMallOrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewBeeMallOrderItemServiceImpl implements NewBeeMallOrderItemService {
    @Autowired
    private NewBeeMallOrderItemMapper newBeeMallOrderItemMapper;

    @Override
    public List<NewBeeMallOrderItem> findByOrderId(Long orderId) {
        LambdaQueryWrapper<NewBeeMallOrderItem> orderItemQueryWrapper = new LambdaQueryWrapper<>();
        orderItemQueryWrapper.eq(NewBeeMallOrderItem::getOrderId, orderId);

        return newBeeMallOrderItemMapper.selectList(orderItemQueryWrapper);
    }
    @Override
    public List<NewBeeMallOrderItem> findByOrderItemId(Long orderItemId) {
        LambdaQueryWrapper<NewBeeMallOrderItem> orderItemQueryWrapper = new LambdaQueryWrapper<>();
        orderItemQueryWrapper.eq(NewBeeMallOrderItem::getOrderItemId, orderItemId);

        return newBeeMallOrderItemMapper.selectList(orderItemQueryWrapper);
    }
}
